package net.zoneland.geological.timerjobs;

import org.apache.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import net.zoneland.geological.devicedata.service.Tbl_deep_move_device_dataServiceI;
import net.zoneland.geological.devicedata.service.Tbl_rain_device_dataServiceI;
import net.zoneland.geological.devicedata.service.Tbl_surface_move_device_dataServiceI;
import net.zoneland.geological.devicedata.service.Tbl_water_device_dataServiceI;
import net.zoneland.greenleaf.GLOBAL;

/**
 * 对数据表里的数据进行分析
 * @author liyi
 *
 */
public class Job_DeviceDataAnalyse implements Job{
     
	public static Logger logger = Logger.getLogger(Job_DeviceDataAnalyse.class);	
	public Tbl_deep_move_device_dataServiceI deep_move_device_dataService = null;
	public Tbl_rain_device_dataServiceI tbl_rain_device_dataService = null;
	public Tbl_surface_move_device_dataServiceI tbl_surface_move_device_dataService = null;
	public Tbl_water_device_dataServiceI tbl_water_device_dataService = null;
	
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {		
		logger.info( ">>>>>>>>系统开始对采集的数据进行分析......" );
		deep_move_device_dataService = (Tbl_deep_move_device_dataServiceI) GLOBAL.springContext.getBean( "deep_move_device_dataService" );
		tbl_rain_device_dataService = (Tbl_rain_device_dataServiceI) GLOBAL.springContext.getBean( "tbl_rain_device_dataService" );
		tbl_surface_move_device_dataService = (Tbl_surface_move_device_dataServiceI) GLOBAL.springContext.getBean( "tbl_surface_move_device_dataService" );
		tbl_water_device_dataService = (Tbl_water_device_dataServiceI) GLOBAL.springContext.getBean( "tbl_water_device_dataService" );
		
		//1、表tbl_deep_move_device_data
		try {
			logger.info( ">>>>>>>>1/4 系统开始对采集的数据表[tbl_deep_move_device_data]分析......" );
			deep_move_device_dataService.analyseDeviceData();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}		
		
		//2、表tbl_surface_move_device_data
		try {
			logger.info( ">>>>>>>>2/4 系统开始对采集的数据表[tbl_surface_move_device_data]分析......" );
			tbl_surface_move_device_dataService.analyseDeviceData();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		//3、表tbl_water_device_data	
		try {
			logger.info( ">>>>>>>>3/4 系统开始对采集的数据表[tbl_water_device_data]分析......" );
			tbl_water_device_dataService.analyseDeviceData();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		//4、表tbl_rain_device_data
		try {
			logger.info( ">>>>>>>>4/4 系统开始对采集的数据表[tbl_rain_device_data]分析......" );
			tbl_rain_device_dataService.analyseDeviceData();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
		logger.info( ">>>>>>>>对采集的数据分析全部完成！" );
	}

}
